package com.heima.minio.config;

import io.minio.MinioClient;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(MinioConfigParam.class)
public class ClientConfig {

    @Bean
    public MinioClient client(MinioConfigParam configParam){
        //之前玩儿redis redis IP port
        //TODO 优化1
        MinioClient minioClient =
                MinioClient.builder()
                        .endpoint(configParam.getEndpoint())
                        .credentials(configParam.getAccessKey(),configParam.getSecretKey())
                        .build();
        return minioClient;
    }
}
